/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-03-08     Hao       the first version
 */
#ifndef SIMPLEFOC_DRIVER_H_
#define SIMPLEFOC_DRIVER_H_

class Driver
{
public:
    Driver();
    ~Driver();

    // 硬件初始化
    void init();

    // 使能/失能电机驱动，需要用户自定义实现
    void enable();
    void disable();

    /**
     * Set phase voltages to the harware
     *
     * @param Ua - phase A voltage
     * @param Ub - phase B voltage
     * @param Uc - phase C voltage
     */
    void setPwm(float Ua, float Ub, float Uc);

    // 硬件设置pwm接口
    void set_hardware_pwm(float duty_cycle_a, float duty_cycle_b, float duty_cycle_c);

    float voltage_power_supply_; // power supply voltage
    float voltage_limit_;        // limiting voltage set to the motor

private:
    // 当前占空比
    float duty_a_; // currently set duty cycle on phaseA
    float duty_b_; // currently set duty cycle on phaseB
    float duty_c_; // currently set duty cycle on phaseC
};

#endif /* SIMPLEFOC_DRIVER_H_ */
